home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / mint / duftp / main.c < prev    next >
C/C++ Source or Header  |  1995-06-17  |  3KB  |  104 lines

  1. /*
  2.     DUFTP
  3. */
  4.  
  5. #include <DULIB.H>
  6. #include <SETJMP.H>
  7. #include "servers.h"
  8. #include "init.h"
  9. #include "globals.h"
  10. #include "duftp_n.h"
  11.  
  12. short main(int argc, char *argv[])
  13. {
  14.     OBJECT *a;
  15.     char rfile[FMSIZE],lfile[FMSIZE],*n;
  16.     event e;
  17.     server_list *s;
  18.     short f;
  19.     
  20. // CALL INITIALISATION
  21.     initialise();
  22.     
  23. // CENTRAL EVENT LOOP
  24.     do{
  25.         setjmp(recover_main);
  26.         e=WaitEvent();
  27.         switch(e)
  28.         {
  29.             case mev_SELBOOKMARK:    // Bookmark selected, update currently displayed info
  30.                 s=servers;
  31.                 for(f=1; f<server_count-scroll_selection; f++) s=s->next;
  32.                 selected_server=s;
  33.                 set_dialog_text(Mainwindow, This_server, s->name);
  34.                 set_dialog_text(Hosts, Server_name, s->name);
  35.                 set_dialog_text(Hosts, Ip_address, s->ip_name);
  36.                 set_dialog_text(Hosts, Login_name, s->login);
  37.                 set_dialog_text(Hosts, Login_password, s->password);
  38.                 set_dialog_text(Hosts, Login_path, s->path);
  39.                 sprintf(new_server_login,"%s",s->login);
  40.                 sprintf(new_server_address,"%s",s->ip_name);
  41.                 sprintf(new_server_password,"%s",s->password);
  42.                 sprintf(new_server_path,"%s",s->path);
  43.                 rsrc_gaddr(0,Hosts,&a);
  44.                 objc_draw(a,Server_name,0,scrn_x,scrn_y,scrn_w,scrn_h);
  45.                 objc_draw(a,Ip_address,0,scrn_x,scrn_y,scrn_w,scrn_h);
  46.                 objc_draw(a,Login_name,0,scrn_x,scrn_y,scrn_w,scrn_h);
  47.                 objc_draw(a,Login_password,0,scrn_x,scrn_y,scrn_w,scrn_h);
  48.                 objc_draw(a,Login_path,0,scrn_x,scrn_y,scrn_w,scrn_h);
  49.                 break;
  50.             case mev_REMOTEFILE:
  51.                 n=remote_files[scroll_selection];
  52.                 if (n[0]!='')
  53.                 {
  54.                     n=n+2;
  55.                     sscanf(n,"%s",rfile);
  56.                     get_file(rfile);
  57.                 }
  58.                 break;
  59.             case mev_CHANGEREMOTEDIR:
  60.                 n=remote_files[scroll_selection];
  61.                 if (n[0]=='')
  62.                 {
  63.                     n=n+2;
  64.                     sscanf(n,"%s",rfile);
  65.                     change_remote_directory(rfile);
  66.                 }
  67.                 break;
  68.             case mev_CHANGELOCALDIR:
  69.                 n=local_files[scroll_selection];
  70.                 if (n[0]=='')
  71.                 {
  72.                     n=n+2;
  73.                     sscanf(n,"%s",rfile);
  74.                     sprintf(lfile,"%s/%s",current_local_path,rfile);
  75.                     chdir(lfile);
  76.                     getcwd(rfile,FMSIZE);
  77.                     if (!strncmp("/dev",rfile,4))
  78.                     {
  79.                         if ((rfile[5]=='u')&&(rfile[6]=='/'))
  80.                             sprintf(current_local_path,"u:%s",rfile+6);
  81.                         else
  82.                             sprintf(current_local_path,"u:%s",rfile+4);
  83.                     }else{
  84.                         sprintf(current_local_path,"%s",rfile);
  85.                     }
  86.                     get_local_files();
  87.                     if (local_files) free(local_files);
  88.                     f=file_count;
  89.                     local_files=extract_filenames(local_directory);
  90.                     local_file_count=file_count;
  91.                     file_count=f;
  92.                     Change_scroll_list(Mainwindow, Local_fs, local_files, local_file_count+1);
  93.                     rsrc_gaddr(0,Mainwindow,&a);
  94.                     objc_draw(a,Local_path,0,scrn_x,scrn_y,scrn_w,scrn_h);
  95.                 }
  96.                 break;
  97.         }
  98.     }while(e!=mev_QUIT);
  99.  
  100.     close_down();        // Shut down the GUI
  101.  
  102.     return 0;
  103. }
  104.